<template>
  <section>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane v-for="(item, index) in acList" :label="item.label" :name="item.name" :key="index"></el-tab-pane>
      <!-- <el-tab-pane label="消费记录" name="record"></el-tab-pane> -->
    </el-tabs>
    <div>
      <comm v-if="active" :is="activeName" :detail="detail"></comm>
    </div>
  </section>
</template>
<script>
export default {
  name: "chargeIndexV2",
  data() {
    return {
      activeName: "pay",
      acList: [
        {
          label: "待付费",
          name: "pay"
        },
        {
          label: "待支付",
          name: "payment"
        },
        {
          label: "已收费",
          name: "overpay"
        },
        {
          label: "已退费",
          name: "sof"
        }
        // ,{
        //   label:"挂账记录",
        //   name:"account"
        // }
      ],
      active: false,
      detail: ""
    };
  },
  created() {},
  mounted() {
    let th = this;
    th.active = true;
    let type = th.$route.query.type;
    if (type) {
      switch (parseInt(type)) {
        case 0:
          th.activeName = "pay";
          break;
        case 1:
          th.activeName = "payment";
          break;
        case 2:
          th.activeName = "overpay";
          break;
        case 3:
          th.activeName = "sof";
          break;
        // default:
        //    th.activeName="account";
        //    break;
      }
    }
  },
  methods: {
    handleClick(tab, event) {
      //    let th=this;
      //    let j={
      //      type:tab.index
      //    }
      //   th.$router.push({
      //     path: '/page/chargeIndex',
      //     query: th.getUrlToken(j)
      //   });
    }
  },
  components: {
    //   待付费
    pay: () => import("./_child/toBePaid"),
    // 待支付
    payment: () => import("./_child/noPayment"),
    // 已收费
    overpay: () => import("./_child/hasCharge"),
    // 已退费
    sof: () => import("./_child/returnPayment")
    // 挂账
    // account:() => import("./_child/account"),
  }
};
</script>
<style lang="scss" scoped></style>
